<?php

namespace App\Http\Middleware;

use App\Traits\ApiResponseTrait;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class CheckSgin
{
    use ApiResponseTrait;
    /**
     * Handle an incoming request.
     *
     * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        $app_id = 'video56554525';
        $random = $request->input('random','');
        $sign = $request->input('sign','');
        $c_sign = strtolower(md5($app_id.$random));
        if($sign != $c_sign){
//            return $this->error('签名错误');
        }
        return $next($request);
    }
}
